package Task;

/**
 * 任务模型类
 * @version 1.0
 * @author bug-fsh
 */
public class Task<T> {
    //任务ID
    private int id;
    //任务业务数据
    private T data;
    //任务处理接口
    private ITaskHandle taskHandle;

    public Task(int id, T data, ITaskHandle taskHandle) {
        this.id = id;
        this.data = data;
        this.taskHandle = taskHandle;
    }

    public void handle() {
        this.taskHandle.handle(this);
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    public ITaskHandle getTaskHandle() {
        return taskHandle;
    }

    public void setTaskHandle(ITaskHandle taskHandle) {
        this.taskHandle = taskHandle;
    }
}
